#include <cstdio>
#include <String>
#include <iostream>
using namespace std;
//求数字位数
int dig(int N) {
	int isDig = 0;
	while (N)
	{
		isDig++;
		N /= 10;
	}
	return isDig;
}
//快速幂方法
int mypow(int x, int y)
{
	int s = 1, q = x;
	while (y)
	{
		if (y % 2)
		{
			s = s * q;
		}
		q = q * q;
		y = y / 2;
	}
	return s;
}
//求最高位
int zuigao(int N) {
	return N / mypow(10, dig(N) - 1);
}
//求余项
int yubu(int N) {
	return N % mypow(10, dig(N) - 1);
}
//求值满情况各数字出现次数
int f(int n) {
	return n * mypow(10, n - 1);
}
//计算多余0的个数
int Sling(int n) {
	return (1 - mypow(10, dig(n))) / (1 - 10);
}
void CountPaper(int page, int papers[]) {
	int n = dig(page); //求位数
	int m = zuigao(page); //求最高位
	int m1 = yubu(page);//求除去最高位的余部

	int x = f(n - 1);//如果为非值满情况 则先求出 n-1位各个数字出现情况
	for (int i = 0; i < 10; i++)
	{
		papers[i] += m * x;
	}
	for (int i = 0; i < m; i++)
	{
		papers[i] += mypow(10, n - 1);
	}

	papers[m] += m1 + 1;
	papers[0] += (n - dig(m1) - 1) * (m1 + 1);

	if (m1 == 0)return;
	else CountPaper(m1, papers);
}
int main() {

	FILE* f1, * f2;
	string inFile;
	string outFile;
	for (int i = 0; i < 10; i++)
	{
		const char* inFilCh = NULL;
		const char* outFilCh = NULL;

		inFile = "TEST\\COUNT";
		outFile = "PUT\\PUT";
		string num = to_string(i);
		inFile = inFile + num + ".IN";
		outFile = outFile + num + ".OUT";

		inFilCh = inFile.data();
		outFilCh = outFile.data();
		f1 = fopen(inFilCh, "r");
		f2 = fopen(outFilCh, "w");

		int page = 0;
		fscanf(f1, "%d", &page);
		//用来存储各个数字出现次数
		int papers[10] = { 0 };
		CountPaper(page, papers);
		papers[0] -= Sling(page);


		fprintf(f2, "%d\n", papers[0]);
		for (int j = 1; j < 10; j++)
		{
			fprintf(f2, "%d\n", papers[j]);
		}
	}
	fclose(f1);
	fclose(f2);
}